package dispatcher.group.gui.listener;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import dispatcher.gui.GroupDispatcherView;


/**
 * This class waits for an FloorInitializeEvent to appear then starts to
 * initialize and populate new floors based on the event
 * @author Caleb
 *
 */
public class FloorInitializeListener implements ActionListener {

	/**
	 * This method will create new floors in the GUI
	 */
	@Override
	public void actionPerformed(ActionEvent e) {
		
		if (e instanceof FloorInitializeEvent){
			FloorInitializeEvent event = (FloorInitializeEvent)e;
			// Creates new floors
			GroupDispatcherView.getInstance().createFloor(event.getMaxFloors());
			GroupDispatcherView.getInstance().refreshGUI();
		}
	}

}
